<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/template/common/header.jsp"%>
<script type="text/javascript">
	var recommend = {
		uploadSuccess : function(file, data, response) {
			if (!response) {
				return;
			}
			var $this = $(this);
			data = eval("(" + data + ")");
			$this
					.each(function(i) {
						var $wrapper = $this[i].wrapper;
						$wrapper.siblings("input[name='recommend.thumbnail']")
								.val(data.url);
						var fileQue = $wrapper.siblings("div.thumbImg");
						fileQue.empty();
						var img = $("<img src='" + resourceRootUrl + data.url
						+ "' height='150px'/>");
						fileQue.append(img);
					});
		}
	}
</script>
<div class="pageContent">
	<form method="post" action="${base }/recommend!doEdit.action"
		class="pageForm required-validate"
		onsubmit="return validateCallback(this, dialogAjaxDone)">
		<input type="hidden" name="recommend.id" value="${ recommend.id}">
		<div class="pageFormContent" layoutH="55">
			<dl class="unit">
				<dt>标题：</dt>
				<dd>
					<input type="text" name="recommend.title" size="30" minlength="4"
						maxlength="20" class="required" value="${recommend.title }" />
				</dd>
			</dl>
			<dl class="unit">
				<dt>URL：</dt>
				<dd>
					<input type="text" name="recommend.url"
						class="{required:true,url2:true}" value="${ recommend.url}" />
				</dd>

			</dl>
			<dl class="unit">
				<dt>标价：</dt>
				<dd>
					$<input type="text" name="recommend.listPrice"
						class="{required:true,number:true}"
						value="${ recommend.listPrice}" />
				</dd>

			</dl>
			<dl class="unit">
				<dt>卖价：</dt>
				<dd>
					$<input type="text" name="recommend.price"
						class="{required:true,number:true}" value="${recommend.price }">
				</dd>

				</textarea>
			</dl>
			<dl class="unit">
				<dt>序号：</dt>
				<dd>
					<input type="text" name="recommend.orders"
						value="${recommend.orders }" />
				</dd>

			</dl>
			<dl class="unit">
				<dt>来源：</dt>
				<dd>
					<select name="recommend.source">
						<option value="AWS"
							<c:if test="${recommend.source=='AWS' }">selected='selected'</c:if>>amazon</option>
						<option value="EBAY"
							<c:if test="${recommend.source=='EBAY' }">selected='selected'</c:if>>eBay</option>
					</select>
				</dd>
			</dl>
			<dl class="unit">
				<dt>封面图：</dt>
				<dd>
					<input id="${rel }FileRecommendEdit" target="uploadify" type="file"
						name="filedata"
						uploadifyOpts='{"onUploadSuccess":recommend.uploadSuccess}' /> <input
						type="hidden" name="recommend.thumbnail" class="required"
						value="${recommend.thumbnail}">
					<div class="thumbImg">
						<c:if test="${recommend.thumbnail ne null }">
							<img src="${resourceRootUrl}${recommend.thumbnail}" />
						</c:if>
					</div>
				</dd>
			</dl>
		</div>
		<div class="formBar">
			<ul>
				<li><div class="buttonActive">
						<div class="buttonContent">
							<button type="submit">提交</button>
						</div>
					</div></li>
				<li><div class="button">
						<div class="buttonContent">
							<button type="button" class="close">取消</button>
						</div>
					</div></li>
			</ul>
		</div>
	</form>
</div>